using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Threading.Tasks;

namespace CarRentalSystem.Repository;

public interface ICarRepository<TEntity> where TEntity : class,new()
{
    //增删改查  1 row affected > 0

    //添加
    public Task<bool> CreateAsync(TEntity entity);

    //修改

    public Task<bool> UpdateAsync(TEntity entity);
    //删除
    public Task<bool> DeleteAsync(TEntity entity);

    //查:查单条-1.根据Id查，条件   查多条: 查所有，根据条件查多条
    public Task<TEntity> FindByIdAsync(int id);

    public Task<TEntity> FindOneAsync(Expression<Func<TEntity,bool>> exp);  //lambda:

    public Task<List<TEntity>> FindAllAsync();

    public Task<List<TEntity>> FindManyAsync(Expression<Func<TEntity, bool>> exp);
}
